package thinking.enumerated;

import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Set;
import java.util.TreeSet;

import thinking.net.mindview.util.*;
import static thinking.net.mindview.util.Print.*;

enum Explore {HERE, THERE }
public class Reflection {
    public static Set<String> analyze(Class<?> enumClass) {
        print("--------Analyzing " + enumClass + " ------------");
        for (Type t : enumClass.getGenericInterfaces())
            print(t);
        print("Base: " + enumClass.getSuperclass());
        print("Methods: ");
        Set<String> methods = new TreeSet<String>();
        for (Method m : enumClass.getMethods()) {
            methods.add(m.getName());
        }
        print(methods);
        return methods;
    }
    public static void main(String[] args) {
        Set<String> exploreMethods = analyze(Explore.class);
        Set<String> enumMethods = analyze(Enum.class);
        print("Explore.containsAll(Enum)?" + exploreMethods.containsAll(enumMethods));
        printnb("Explore.removeAll(Enum): " + exploreMethods.removeAll(enumMethods));
        print(exploreMethods);
        OSExecute.command("javac Reflection.java");
    }

}
